<html>
<head><meta charset="utf-8"><title>Resolving HIR paths · t-compiler/rust-analyzer · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/index.html">t-compiler/rust-analyzer</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Resolving.20HIR.20paths.html">Resolving HIR paths</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="202425732"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Resolving%20HIR%20paths/near/202425732" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> David Lattimore <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Resolving.20HIR.20paths.html#202425732">(Jun 30 2020 at 12:06)</a>:</h4>
<p>I’d like an API like <code>Semantics::resolve_path</code>, but which would accept a path not obtained from <code>Semantics</code>. Supplied paths would all be absolute. Any thoughts on how such an API should look? I just prototyped with a variant <code>fn resolve_path_at(&amp;self, path: &amp;ast::Path, context: &amp;SyntaxNode) -&gt; Option&lt;PathResolution&gt;</code>. My use-case is for adding type constraints on SSR placeholders.</p>



<a name="202425899"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Resolving%20HIR%20paths/near/202425899" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Resolving.20HIR.20paths.html#202425899">(Jun 30 2020 at 12:08)</a>:</h4>
<p>something like that should probably take a HIR path, not an AST path. If the path is always absolute it might be enough to also pass a <code>Crate</code> as context, or maybe it could be a method on <code>Crate</code></p>



<a name="202425974"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Resolving%20HIR%20paths/near/202425974" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Resolving.20HIR.20paths.html#202425974">(Jun 30 2020 at 12:09)</a>:</h4>
<p>although there's also already <code>resolve_hir_path</code> in <code>SemanticsScope</code></p>



<a name="202426281"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Resolving%20HIR%20paths/near/202426281" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Resolving.20HIR.20paths.html#202426281">(Jun 30 2020 at 12:12)</a>:</h4>
<p>so... actually I think that should be what you're looking for?</p>



<a name="202427003"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Resolving%20HIR%20paths/near/202427003" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> David Lattimore <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Resolving.20HIR.20paths.html#202427003">(Jun 30 2020 at 12:21)</a>:</h4>
<p>Ah, you're right. That does do what I was after. Thanks!</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>